import require from './fetch'
import apis from "@/apis"

export function http(params: any){
  // const api = apis.
  // console.log("params ==> ", params);
  // console.log(apis[params]);
  let p = apis[params]
  
  return require({
    method: p.method,
    url: p.prefix ?  p.prefix + p.url : p.url
  }).then(({data}) => {
    // console.log("rrrrrrrrrrrres ==> ", data);
    if(data.retCode || data.succ ){
      return Promise.resolve(data)
    }else{
      return Promise.reject(data)
    }
  }).catch(err => {
    console.log("eeeeeeeeeeeeeeeerrr ==> ", err);
    return Promise.reject()
    
  })


}


